package com.qtyx.nms.ui.activity

import com.qtyx.nms.R
import com.qtyx.nms.ui.base.BaseActivity
import com.qtyx.nms.util.Tools
import com.qtyx.nms.util.shared.AppInfoShared
import kotlinx.android.synthetic.main.ac_setting.*

/**
 * 设置
 */
class SettingActivity:BaseActivity() {
    override fun getLayoutId()= R.layout.ac_setting

    override fun initData() {
        //版本号
        tvSettingVersionName.text="V${Tools.getVersionName(mContext)}"

        //设置是否轮播
        if(AppInfoShared.getTabAutoLunBo()){
            rbTabLunBoYes.isChecked=true
        }else{
            rbTabLunBoNo.isChecked=true
        }

        //选中状态改变事件
        rbTabLunBoYes.setOnCheckedChangeListener { buttonView, isChecked ->
            AppInfoShared.saveTabAutoLunBo(isChecked)
        }

        //设置轮播时间
        tvTabLunBoTimeNum.text=AppInfoShared.getTabAutoLunBoTime().toString()
        //减时间-1
        tvTabLunBoTimeMinus.setOnClickListener {
            var time=tvTabLunBoTimeNum.text.toString().toInt()
            if(time>1){
                time-=1
                tvTabLunBoTimeNum.text=time.toString()
                AppInfoShared.saveTabAutoLunBoTime(time)
            }
        }
        //加时间+1
        tvTabLunBoTimePlus.setOnClickListener {
            var time=tvTabLunBoTimeNum.text.toString().toInt()
            time++
            tvTabLunBoTimeNum.text = time.toString()
            AppInfoShared.saveTabAutoLunBoTime(time)
        }

        //进入选择皮肤
        btnSettingSkin.setOnClickListener {
            startActivityCustom(SkinSelectActivity::class.java)
        }

    }



}